﻿#pragma once

#include <occmesh/api/arap.h>
#include <occmesh/api/lscm.h>
#include <occmesh/api/param.h>

#include <BRepBuilderAPI_MakeFace.hxx>

#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>

class MeshFit
{
  private:
    MeshPtr m_mesh;

  public:
    MeshFit(MeshPtr mesh);

    TopoDS_Face Build(std::vector<std::vector<int>> &cornerNodes, std::vector<std::vector<int>> &boundaryNodes);

    void Parameterize();
    Handle(Geom_BSplineSurface) BuildSurface();
    void FixNodes(std::vector<int> &cornerNodes, std::vector<int> &boundaryNodes);
    std::vector<Handle(Geom2d_Curve)> BuildBoundaryCurves(const std::vector<int> &cornerNodes,
                                                          const std::vector<int> &boundaryNodes);
};